#include "znx_http_base.h"


const char *
znx_http_get_response_reason(int status_code)
{
    switch (status_code){
    case ZNX_HTTP_CONTINUE:
        return "Continue";

    case ZNX_HTTP_SWITCHING_PROTOCOLS:
        return "Switching Protocols";

    case ZNX_HTTP_PROCESSING:
        return "Processing";

    case ZNX_HTTP_OK:
        return "Ok";

    case ZNX_HTTP_CREATED:
        return "Created";

    case ZNX_HTTP_ACCEPTED:
        return "Accepted";

    case ZNX_HTTP_NO_CONTENT:
        return "No Content";

    case ZNX_HTTP_PARTIAL_CONTENT:
        return "Partial Content";

    case ZNX_HTTP_MULTIPLE_CHOICES:
        return "Multiple Choices";

    case ZNX_HTTP_MOVED_PERMANENTLY:
        return "Moved Permanently";

    case ZNX_HTTP_MOVED_TEMPORARILY:
        return "Moved Temporarily";

    case ZNX_HTTP_NOT_MODIFIED:
        return "Not Modified";

    case ZNX_HTTP_TEMPORARY_REDIRECT:
        return "Temporary Redirect";

    case ZNX_HTTP_PERMANENT_REDIRECT:
        return "Permanent Redirect";

    case ZNX_HTTP_BAD_REQUEST:
        return "Bad Request";

    case ZNX_HTTP_UNAUTHORIZED:
        return "Unauthorized";

    case ZNX_HTTP_FORBIDDEN:
        return "Forbidden";

    case ZNX_HTTP_NOT_FOUND:
        return "Not Found";

    case ZNX_HTTP_NOT_ALLOWED:
        return "Not Allowed";

    case ZNX_HTTP_REQUEST_TIME_OUT:
        return "Request Time-out";

    case ZNX_HTTP_LENGTH_REQUIRED:
        return "Length Required";

    case ZNX_HTTP_REQUEST_ENTITY_TOO_LARGE:
        return "Request Entity Too Large";

    case ZNX_HTTP_REQUEST_URI_TOO_LARGE:
        return "Request-URI Too Large";

    case ZNX_HTTP_RANGE_NOT_SATISFIABLE:
        return "Requested Range Not Satisfiable";

    case ZNX_HTTP_TOO_MANY_REQUESTS:
        return "Too Many Requests";

    case ZNX_HTTP_INTERNAL_SERVER_ERROR:
        return "Internal Server Error";

    case ZNX_HTTP_NOT_IMPLEMENTED:
        return "Not Implemented";

    case ZNX_HTTP_BAD_GATEWAY:
        return "Bad Gateway";

    case ZNX_HTTP_SERVICE_UNAVAILABLE:
        return "Service Temporarily Unavailable";

    case ZNX_HTTP_GATEWAY_TIME_OUT:
        return "Gateway Time-out";

    case ZNX_HTTP_VERSION_NOT_SUPPORTED:
        return "HTTP Version Not Supported";

    default:
        return "Unknow";
    }
}


znx_str_t znx_http_version_10 = {
    .data = (u_char *)ZNX_HTTP_VERSION_10_STR,
    .len = ZNX_HTTP_VERSION_10_STR_LEN
};


znx_str_t znx_http_version_11 = {
    .data = (u_char *)ZNX_HTTP_VERSION_11_STR,
    .len = ZNX_HTTP_VERSION_11_STR_LEN
};


znx_http_header_name_t znx_http_host_hdr_name = {
    .data = (u_char *)ZNX_HTTP_HOST_HDR,
    .len = ZNX_HTTP_HOST_HDR_LEN,
};


znx_http_header_name_t znx_http_connection_hdr_name = {
    .data = (u_char *)ZNX_HTTP_CONNECTION_HDR,
    .len = ZNX_HTTP_CONNECTION_HDR_LEN,
};


znx_http_header_name_t znx_http_content_length_hdr_name = {
    .data = (u_char *)ZNX_HTTP_CONTENT_LENGTH_HDR,
    .len = ZNX_HTTP_CONTENT_LENGTH_HDR_LEN,
};


znx_http_header_name_t znx_http_range_hdr_name = {
    .data = (u_char *)ZNX_HTTP_RANGE_HDR,
    .len = ZNX_HTTP_RANGE_HDR_LEN,
};


znx_http_header_name_t znx_http_transfer_encoding_hdr_name = {
    .data = (u_char *)ZNX_HTTP_TRANSFER_ENCODING_HDR,
    .len = ZNX_HTTP_TRANSFER_ENCODING_HDR_LEN,
};


znx_http_header_name_t znx_http_trailer_hdr_name = {
    .data = (u_char *)ZNX_HTTP_TRAILER_HDR,
    .len = ZNX_HTTP_TRAILER_HDR_LEN,
};
